/*     */ package com.lmpop.trade.ti_voucher;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_PaymentRulesInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_PaymentRulesInfo()
/*     */   {
/*  17 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  26 */     Ti_PaymentRules ti_PaymentRules = new Ti_PaymentRules();
/*  27 */     ti_PaymentRules.setVoucher_type(map.getString("voucher_type"));
/*  28 */     ti_PaymentRules.setRule_id(map.getString("rule_id"));
/*  29 */     ti_PaymentRules.setMember_level(map.getString("member_level"));
/*  30 */     ti_PaymentRules.setLimit_number(map.getString("limit_number"));
/*  31 */     String result_code = "0";
/*     */     try {
/*  33 */       insert(dbmMgr, ti_PaymentRules);
/*     */     } catch (ApplicationException e) {
/*  35 */       e.printStackTrace();
/*  36 */       result_code = "1";
/*     */     }
/*  38 */     map.setString("result_code", result_code);
/*  39 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_PaymentRules Ti_PaymentRules)
/*     */     throws ApplicationException
/*     */   {
/*  48 */     dbmMgr.update("insertTi_PaymentRules", Ti_PaymentRules);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  58 */     String pkid_string = map.getString("pkid");
/*  59 */     String result_code = "0";
/*     */     try {
/*  61 */       if (!pkid_string.equals("")) {
/*  62 */         String[] pkStr = pkid_string.split("\\|");
/*  63 */         for (int i = 0; i < pkStr.length; i++) {
/*  64 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  68 */       e.printStackTrace();
/*  69 */       result_code = "1";
/*     */     }
/*  71 */     map.setString("result_code", result_code);
/*  72 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  81 */     dbmMgr.update("deleteTi_PaymentRules", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  90 */     Ti_PaymentRules ti_PaymentRules = new Ti_PaymentRules();
/*  91 */     ti_PaymentRules.setVoucher_type(map.getString("voucher_type"));
/*  92 */     ti_PaymentRules.setRule_id(map.getString("rule_id"));
/*  93 */     ti_PaymentRules.setMember_level(map.getString("member_level"));
/*  94 */     ti_PaymentRules.setLimit_number(map.getString("limit_number"));
/*  95 */     String result_code = "0";
/*     */     try {
/*  97 */       update(dbmMgr, ti_PaymentRules);
/*     */     } catch (ApplicationException e) {
/*  99 */       e.printStackTrace();
/* 100 */       result_code = "1";
/*     */     }
/* 102 */     map.setString("result_code", result_code);
/* 103 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_PaymentRules Ti_PaymentRules)
/*     */     throws ApplicationException
/*     */   {
/* 112 */     dbmMgr.update("updateTi_PaymentRules", Ti_PaymentRules);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 122 */     Hashtable Ti_PaymentRules = (Hashtable)obj;
/* 123 */     if (start == 0)
/* 124 */       start = 0;
/*     */     else {
/* 126 */       start = (start - 1) * limit;
/*     */     }
/* 128 */     Ti_PaymentRules.put("start", Integer.valueOf(start));
/* 129 */     Ti_PaymentRules.put("limit", Integer.valueOf(limit));
/* 130 */     return this.queryList.getList("getListByTi_PaymentRulesPage", Ti_PaymentRules);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 141 */     Hashtable Ti_PaymentRules = (Hashtable)obj;
/* 142 */     List list = this.queryList.getList("getCountByObjTi_PaymentRules", Ti_PaymentRules);
/* 143 */     int count = 0;
/* 144 */     if ((list != null) && (list.size() > 0)) {
/* 145 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 146 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 147 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 150 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 160 */     return this.queryList.getList("getTi_PaymentRulesByPk", pk);
/*     */   }
/*     */ 
/*     */   public int getRulebyType(String type, String level) {
/* 164 */     Ti_PaymentRules rules = new Ti_PaymentRules();
/* 165 */     rules.setVoucher_type(type);
/* 166 */     rules.setMember_level(level);
/* 167 */     List list = this.queryList.getList("getRulebyType", rules);
/* 168 */     int count = 0;
/* 169 */     Hashtable newsMap = null;
/* 170 */     if ((list != null) && (list.size() > 0)) {
/* 171 */       newsMap = (Hashtable)list.get(0);
/* 172 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 173 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 176 */     return count;
/*     */   }
/*     */ 
/*     */   public String getSelectString(String voucher_typeparam) {
/* 180 */     List list = this.queryList.getList("getRuletList");
/* 181 */     String selectString = "";
/* 182 */     String voucher_type = ""; String rule_id = "";
/* 183 */     if ((list != null) && (list.size() > 0)) {
/* 184 */       for (int i = 0; i < list.size(); i++) {
/* 185 */         Hashtable newsMap = (Hashtable)list.get(i);
/* 186 */         if ((newsMap.get("voucher_type") != null) && (!newsMap.get("voucher_type").toString().equals(""))) {
/* 187 */           voucher_type = newsMap.get("voucher_type").toString();
/*     */         }
/* 189 */         if ((newsMap.get("rule_id") != null) && (!newsMap.get("rule_id").toString().equals(""))) {
/* 190 */           rule_id = newsMap.get("rule_id").toString();
/*     */         }
/* 192 */         if (voucher_type.equals(voucher_typeparam))
/* 193 */           selectString = selectString + "<option value='" + rule_id + "'selected>" + voucher_type + "</option>";
/*     */         else {
/* 195 */           selectString = selectString + "<option value='" + rule_id + "'>" + voucher_type + "</option>";
/*     */         }
/*     */       }
/*     */     }
/* 199 */     return selectString;
/*     */   }
/*     */ 
/*     */   public Map getRuleByParams(String rule, String useagerules, String memberlevel)
/*     */   {
/* 204 */     Hashtable map = new Hashtable();
/* 205 */     map.put("usage_rules", useagerules);
/* 206 */     List list = null;
/* 207 */     if (useagerules.equals("3")) {
/* 208 */       list = this.queryList.getList("getRuleByUsage", map);
/*     */     } else {
/* 210 */       map.put("member_level", memberlevel);
/* 211 */       list = this.queryList.getList("getRuleByParams", map);
/*     */     }
/*     */ 
/* 215 */     String voucher_type = ""; String rule_id = ""; String limit_number = "";
/* 216 */     Hashtable result = new Hashtable();
/* 217 */     if ((list != null) && (list.size() > 0))
/*     */     {
/* 219 */       for (int i = 0; i < list.size(); i++) {
/* 220 */         Hashtable newsMap = (Hashtable)list.get(i);
/* 221 */         if ((newsMap.get("voucher_type") != null) && (!newsMap.get("voucher_type").toString().equals(""))) {
/* 222 */           voucher_type = newsMap.get("voucher_type").toString();
/*     */         }
/* 224 */         if ((newsMap.get("rule_id") != null) && (!newsMap.get("rule_id").toString().equals(""))) {
/* 225 */           rule_id = newsMap.get("rule_id").toString();
/*     */         }
/* 227 */         if ((newsMap.get("limit_number") != null) && (!newsMap.get("limit_number").toString().equals(""))) {
/* 228 */           limit_number = newsMap.get("limit_number").toString();
/*     */         }
/* 230 */         result.put(rule_id, voucher_type + "|" + limit_number);
/*     */       }
/*     */ 
/*     */     }
/*     */ 
/* 238 */     return result;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_voucher.Ti_PaymentRulesInfo
 * JD-Core Version:    0.6.0
 */